package com.ktjiaoyu.crm.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ktjiaoyu.crm.mapper.UserMapper;
import com.ktjiaoyu.crm.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements UserService {

    @Resource
    private UserMapper userMapper;
    @Override
    public User login(String usrName, String usrPassword) {
        QueryWrapper wq=new QueryWrapper();
        wq.eq("usr_name",usrName);
        wq.eq("usr_password",usrPassword);
        return userMapper.selectOne(wq);
    }

    @Override
    public User addUser(User user) {
        return null;
    }

    @Override
    public void deleteUser(Long usrId) {

    }

    @Override
    public User updateUser(User user) {
        return null;
    }

    @Override
    public User getUser(Long usrId) {
        QueryWrapper wq = new QueryWrapper();
        wq.eq("usr_id",usrId);
        User user = userMapper.selectOne(wq);
        return user;
    }

    @Override
    public List<User> findAllUsers() {
        return userMapper.selectList(null);
    }
}
